<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@include file="/WEB-INF/base.jspf"%>
<!DOCTYPE html>
<html>
<head>
<title>公告设置</title>
<style>
	.nav{
		display:flex;
		justify-content: center;
		
	}
	
	#new{
		width:15%;
		text-align: center;
		background: #555;
		color: #fff;
		padding:5px;
		cursor: pointer;
		margin-top:20px;
	}
	
	#type-list ul li span{
		font-size:14px;
	}


	.div-c-table {
		display:none;
		padding-top:16px;
	}
	.div-c-table-active {
		display:block;
	}
		.modal-dialog {
		max-width: 1000px;
	}
	.control-btns button + button {
		margin-left:10px;
	}
	
	
			
	
	
	#editPayOnLine .p-c-flexwrapper, #editQuickGetMoney .p-c-flexwrapper {
		display:flex;
		align-items:center;
		margin-bottom:16px;
		margin-right:16px;
	}
	
	
	
	#editPayOnLine1 .p-c-flexwrapper, #editQuickGetMoney .p-c-flexwrapper {
		display:flex;
		align-items:center;
		margin-bottom:16px;
		margin-right:16px;
	}
	#editPayOnLine1 .p-c-flexwrapper input.mode-pay{
		/* width:100px;
		height:100px; */
	 }
	#editPayOnLine .p-c-flexwrapper span, #editQuickGetMoney .p-c-flexwrapper span {
		width:110px;
		text-align: center;
	}
	
	#editPayOnLine1 .p-c-flexwrapper span, #editQuickGetMoney .p-c-flexwrapper span {
    width: 110px;
    text-align: center;
}
	#editPayOnLine .p-c-flexwrapper .form-control, #editQuickGetMoney .p-c-flexwrapper .form-control {
		width:200px;
	}
	
	#editPayOnLine1 .p-c-flexwrapper .form-control, #editQuickGetMoney .p-c-flexwrapper .form-control {
    width: 200px;
}

	
	
	#editPayOnLine1 .modal-body, #editQuickGetMoney .modal-body {
		display:flex;
		flex-wrap:wrap;
	}
	.hiddenId {
		display:none;
	}
	.demo-list ul{
	
	display：block;
	width:380px;
	overflow:hidden;
	justify-content: center;
	align-items: center;
	font-size:14px;
	} 
	
	.demo-list ul li{
	    float:left;
	    width:45%;
	    margin-right:6px;
	     margin-top:6px;
	     margin-bottom:6px;
	    padding: 6px 12px;
	   /*  color: #fff;
	    background-color: #204d74; */
	    
	    border: 1px solid #ccc;
	    border-radius: 4px;
	}
	.form-control {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    font-size: 1rem;
    line-height: 1.25;
    color: #495057;
    background-color: #fff;
    background-image: none;
    background-clip: padding-box;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: .25rem;
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
	
</style>
</head>
<body>	
<ul class="nav nav-pills"  >
	<li class="active"><a >首页公告</a></li>
	<!-- <li class="active" id="new"><a href="#" style="background: #666" color="#fff" >新增支付信息</a></li> -->
</ul>
<div id="new"></div>
<div class="div-c-table div-c-table-active" id="div-c-table1">
	<table id="table-i-onlinePayTable" data-path='updateOnlineState' class="table-ajax-datatables table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<th class="hiddenId"></th>	
				<th>公告内容</th>
				<th>操作</th>
			</tr>
		<tbody id="zhifuxiangqing">
		</tbody> 
	</table>
</div>
<div class="div-c-table" id="div-c-table2">
<table id="table-i-quickPayTable" data-path='updateFastOnlineState' class="table-ajax-datatables table table-striped table-bordered table-hover">
		<tbody>
		</tbody>
</table>
</div>
	<!-- 修改的模态框（Modal） -->
	<div class="modal fade" id="editPayOnLine" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	    <div class="modal-dialog" style="width:860px;">
	        <div class="modal-content">
	            <div class="modal-header">
		            <h4>修改公告</h4>
	                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
	            </div>
	            <div class="modal-body">
	            	<div class="modal-body">
      					<textarea id="textarea-i-fanshuiRoleText" placeholder="输入新的公告" class="form-control" style="resize: none; width:100%;font-size: 16px;" rows="6" cols=""></textarea>
   			 		 </div>
	            </div>
	            <div class="modal-footer">
	                <button type="button" class="btn btn-primary">提交更改</button>
	                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	            </div>
	        </div><!-- /.modal-content -->
	    </div><!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->
	<!-- /.modal -->
<!-- tips模态框（Modal） -->
	<div class="modal fade" id="editQuickGetMoney" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	    <div class="modal-tips" style="width:860px;margin-left:25%;margin-top:10%; ">
	        <div class="modal-content" style="width:300px;height:100px;margin-top:40%;margin-left: 40%;display:flex;justify-content: center;align-items: center;">
	        	<span id="tips"></span>
	   		 </div>
	    </div>
	</div>
	<!-- /.modal -->	
	
<!-- 模态框（Modal） -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            </div>
            <div class="modal-body">你确定要删除该选项吗？</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger">删除</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- /.modal -->	
	
<script type="text/javascript">
	//查询数据的事件
	function findInterFace(){
		$.ajax({
			 url:"/kajhsgweasdqtwehghasfdnsak6868/querygg.do",
			 type:"post",
			success:function(data){
				$("div").data("newData",data)
					$("#new")[0].style.display="none";
			        var $tr = $("<tr />");
			            var $td = $("<td></td>");
			            $td.text(data.data);
			            $tr.append($td);
			            var $td = $("<td><button type='button' id='butt-xg' class='btn btn-success btn-saveAlertContent'>修改</button></td>");
			            $tr.append($td);
			        $("#zhifuxiangqing").append($tr);
			        
			        $("#butt-xg").on("click",function(){
			    		$("#editPayOnLine").modal("show")
			    		$("#textarea-i-fanshuiRoleText").text(data.data)
			        })
			}			
		 });  
	}
	findInterFace();
	
	
	$(".btn-primary").on("click",function(){
		$.ajax({
			 url:"/kajhsgweasdqtwehghasfdnsak6868/updatagg.do",
			 type:"post",
			 data:{
				 notice:$("#textarea-i-fanshuiRoleText").val()
			 },
			success:function(data){
				$("#editPayOnLine").modal("hide")
				 window.location.reload();
				 if(data.data == 1){
				    alert("恭喜你修改成功啦")
				 }
				   
			}	
		})
	});
	
    //新增后点击提交的操作
    $("#confirm1").click(function(){
    	var len=$("input[name='content']");
    	 for(j=0;j<len.length;j++){
    		 if(len[j].value==""){
    			$("#editQuickGetMoney").modal("show");
    	  		$("#tips").html("请填写完整信息");
    		}
    	} 
		var inputlen=$("#type-list").find("input");
		var typezhifu=[false,false,false,false,false,false];
		 for(i=0;i<inputlen.length;i++){
			if(inputlen[i].checked==true){
				typezhifu[i]=inputlen[i].checked;
				
			}else{
				typezhifu[i]=inputlen[i].checked;	
			}
		} 
		
		if(typezhifu.indexOf(true)==-1){
			$("#editQuickGetMoney").modal("show");
	  		$("#tips").html("请填写支付方式");
		}	
		
		var paytype=[];
		
		if(typezhifu[0]==true){
			paytype.push("33");	   //微信H5支付
		}
		if(typezhifu[1]==true){
			paytype.push("21");	   //微信扫码支付
		}
		if(typezhifu[2]==true){    //QQ扫码支付
			paytype.push("89");	   
		}
		if(typezhifu[3]==true){    //QQH5支付
			paytype.push("92");	
		}
		if(typezhifu[4]==true){    //银联扫码(借记卡)
			paytype.push("95");	
		}
		if(typezhifu[5]==true){    //银联扫码(信用卡)
			paytype.push("97");	
		}
		if(typezhifu.length!=0){
			paytype=paytype+","
		}
		
		$.ajax({
			url:"/admin/insertRecharge.do",
			type:"post",
			data:{
				"payName":$("#interface-name").val(),
				"dealerURL":$("#Merdomain-name").val(),
				"P_UserId":$("#Mer-code").val(),
				"SalfStr":$("#Mer-security-code").val(),
				"shopName":$("#Mer-name").val(),
				"payInterfaceURL":$("#pay-interface").val(),
				"payQueryURL":$("#asyn-query").val(),
				"P_ChannelId":paytype,
				"minMoney":$("#min-Money").val(),
				"maxMoney":$("#max-Money").val(),	
			},
			success:function(data){
				$("#editPayOnLine1").modal("hide")
				 window.location.reload();
				 if(data.data == 1){
				    alert("恭喜你添加成功啦")
				 }
			}
			
		});
    })
   
 
   



	
</script>
</body>
</html>